import hide_loading from '@dfeidao/atom-wxapp/api/interaction/hide-loading';
import show_loading from '@dfeidao/atom-wxapp/api/interaction/show-loading';
import get_bind from '@dfeidao/atom-wxapp/form/get';
import { IFeidaoAiWeappPage } from '@dfeidao/atom-wxapp/interfaces';
import set_local from '@dfeidao/atom-wxapp/local/set';
import nodejs from '@dfeidao/atom-wxapp/msg/nodejs';
import render from '@dfeidao/atom-wxapp/render/render';

export default async function a003(fd: IFeidaoAiWeappPage) {
	let search = get_bind(fd, 'search') as string;
	if (!search) {
		search = '';
	}
	try {
		// app-pick_list-findByName-1
		const data = await nodejs('ready-list/s002', {
			name: search,
			desc: ['pick_time'],
			page_size: 2,
			page_no: 1,
			filter: {
				product_up_status: "已上架"
			}
		});
		console.log(data, '-----------查询的数据--------------');
		render(fd, {
			data
		});
		set_local(fd, 'page_no', 1);
		set_local(fd, 'list_data', data);
	} catch (error) {
		show_loading('读取数据失败');
		hide_loading();
	}
}
